package org.example.service.impl;

import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.example.dao.OrdersDao;
import org.example.pojo.Orders;
import org.example.service.IOrdersService;
import org.springframework.stereotype.Service;

/**
 * @author TonySong
 * @date 2024/5/15 0015
 * @time 10:44
 */
@Service
@Slf4j
public class OrdersService implements IOrdersService {

    @Resource
    private OrdersDao ordersDao;
    @Override
    public Boolean createOrder(Long uid, Long bid) {
        try {
            Orders orders = new Orders();
            orders.setBid(bid);
            orders.setUid(uid);
            orders.setTotal(1);
            this.ordersDao.save(orders);
            return  true;
        }catch (Exception e){
            log.info(""+e.getMessage());
           return  false;
        }

    }
}
